package com.cloud.code.真题;

import java.util.ArrayList;
import java.util.Scanner;

public class Test1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = Integer.parseInt(scanner.nextLine());
        int m = Integer.parseInt(scanner.nextLine());
        String mStrArr = scanner.nextLine();
        int k = Integer.parseInt(scanner.nextLine());
        ArrayList<Integer> mIntegers = new ArrayList<>();
        String[] mstr = mStrArr.split(" ");
        for (String s : mstr) {
            mIntegers.add(Integer.valueOf(s));
        }
        int res = func(n, mIntegers, k);
        System.out.println(res+1);
    }

    private static int func(int n, ArrayList<Integer> mIntegers, int k) {
        int left = 1, right = 1, currentLen, maxLen = 0;
        while (right <= n) {
            //不满足条件时
            while (!judgeCondition(left, right, mIntegers, k)) {
                left++;
            }
            currentLen = right - left;
            if (maxLen < currentLen) {
                maxLen = currentLen;
            }
            right++;
        }
        return maxLen;
    }

    private static boolean judgeCondition(int left, int right, ArrayList<Integer> mIntegers, int k) {
        int count = 0;
        for (int i = left; i <= right; i++) {
            if (mIntegers.contains(i)) {
                count++;
            }
        }
        return count <= k;
    }
}